package com.shixi.shixitraining.shixitraining.ui.tabhome.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.RequestManager;
import com.shixi.shixitraining.shixitraining.R;
import com.shixi.shixitraining.shixitraining.ui.tabhome.entity.HomeBean;
import com.shixi.shixitraining.shixitraining.util.ImageLoaderUtil;
import com.shixi.shixitraining.shixitraining.view.recycleview.BaseAdapter;
import com.shixi.shixitraining.shixitraining.view.recycleview.BaseRecycleHolder;

import java.util.List;

/**
 * Created by shenyan on 2018/7/9.
 */

public class HomeTrainingGrideAdapter extends BaseAdapter<HomeBean.DataBean.TrainingBean> {

    private RequestManager manager;

    public HomeTrainingGrideAdapter(Context context,List<HomeBean.DataBean.TrainingBean> data, RequestManager manager) {
        super(context,data);
        this.manager = manager;
    }

    @Override
    public void convert(BaseRecycleHolder holder, HomeBean.DataBean.TrainingBean item, int position) {
        holder.setText(R.id.tv_training_price, item.getPrice());
        holder.setText(R.id.tv_hot_title, item.getTitle());
        ImageView view = holder.getView(R.id.iv_hot_training);
        ImageLoaderUtil.displayImage(ImageLoaderUtil.PLAYHOLER_IMAGE_TYPE.MIDDLE_SQUARE,manager, item.getImage(), view);
    }

    @Override
    protected int getLayoutId(int viewType) {
        return R.layout.adapter_home_training;
    }
}
